import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import {LoginService} from '../services/login.service';

@Injectable()
export class CanAcitveGuard implements CanActivate {
  constructor(private lg: LoginService) {}
  canActivate(
    next: ActivatedRouteSnapshot,
    state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
    if (this.lg.str !== '登录') {
      return true;
    } else {
      return false;
    }
  }

}
